package common;

/**
 *
 * 针对异常处理中,业务异常类型的不同的code和message 做统一的声明和管理
 * 枚举要求先把对象声明好,才能使用
 * @author ljc
 * @date 2022/12/11 10:45
 */

public enum ExceptionCode implements BaseErrorInfoInterface{
    /**
     * 枚举的每个字段(常量值)都应该有注释
     */
    WRONG_SERVER(50000, "服务器发生未知错误,请告知班主任和项目经理或稍后再试"),
    WRONG_PHONE_NUMBER(50001, "不是一个有效的手机号码"),
    WRONG_PHONE_NUMBER_OR_EXPIRED(50002,"手机号输入不正确或登录已过期,请重新登录"),
    WRONG_CAPTCHA(50003, "验证码输入不正确或已过期,请重新登录"),
    WRONG_LOGIN_STATUS(50004,"该用户已经冻结"),
    WRONG_TOKEN(50005,"未能正确提供token或token已经过期,请重新登录"),
    WRONG_PERMISSION(50006, "没有操作权限或登录已过期,请重新登录"),
    WRONG_TIMESTAMP(50007, "时间格式不正确"),
    FAILED_LOGIN(50008, "登录失败,请检查用户手机号或密码是否正确"),
    FAILED_SMS(50009, "短信发送失败,请稍后再试"),
    FAILED_DELETE(50010, "删除失败"),
    DUPLICATE_USERNAME(50011, "重复的用户名"),
    DUPLICATE_PHONE(50012,"该手机号已被注册"),
    NULL_TOKEN(50013,"请求中缺少token，请重新登录"),
    NULL_DATA(50014,"数据中有不允许为空的字段,请检查"),
    NULL_PHONE(50015,"手机号不允许为空"),
    NULL_CODE(50016,"验证码不允许为空"),
    FILE_CONTEXT_ERROR(50017,"Excel文件内容有误"),
    FAILED_MODIFY(50018, "操作失败,请检查信息是否符合要求"),
    NULL_GET_DATA(50019,"没有对应的数据"),
    ERROR_TIME(50020,"开始时间大于结束时间"),
    WRONG_PARAMETER(50050,"参数出错"),
    NULL_MGR(50051,"添加工作人员失败"),
    NULL_INPUT(50052,"输入内容为空"),
    NULL_LOGIN(50053,"当前操作需要登录"),

    ;

    /**
     * 业务异常的状态码
     */
    private Integer code;

    /**
     * 业务异常的异常信息
     */
    private String message;

    ExceptionCode(Integer code, String message) {
        this.code = code;
        this.message = message;
    }


    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
